@@ -61,3 +61,6 @@ local_settings.py |
||
| 61 | 61 |
.idea/ |
| 62 | 62 |
media/ |
| 63 | 63 |
collect_static/ |
| 64 |
+ |
|
| 65 |
+# Special File |
|
| 66 |
+download.html |
@@ -1,14 +1,25 @@ |
||
| 1 | 1 |
# -*- coding: utf-8 -*- |
| 2 | 2 |
|
| 3 |
+from django.conf import settings |
|
| 3 | 4 |
from django.contrib import admin |
| 5 |
+from django.template.loader import render_to_string |
|
| 4 | 6 |
|
| 5 | 7 |
from operation.models import FeedbackInfo, GuestEntranceControlInfo, LatestAppInfo, SplashInfo |
| 8 |
+from utils.disk_utils import write_to_disk |
|
| 6 | 9 |
from utils.redis.rversion import delete_guest_entrance_control, set_guest_entrance_control |
| 7 | 10 |
|
| 8 | 11 |
|
| 9 | 12 |
class LatestAppInfoAdmin(admin.ModelAdmin): |
| 10 | 13 |
list_display = ('latest_version', 'latest_app', 'latest_url', 'status', 'created_at', 'updated_at')
|
| 11 | 14 |
|
| 15 |
+ def save_model(self, request, obj, form, change): |
|
| 16 |
+ obj.save() |
|
| 17 |
+ |
|
| 18 |
+ # 更新下载页面 |
|
| 19 |
+ write_to_disk(render_to_string('page/download.tmpl.html', {
|
|
| 20 |
+ 'version': obj.latest_version, |
|
| 21 |
+ }), settings.DOWNLOAD_PAGE_PATH) |
|
| 22 |
+ |
|
| 12 | 23 |
|
| 13 | 24 |
class SplashInfoAdmin(admin.ModelAdmin): |
| 14 | 25 |
list_display = ('splash_image', 'spalash_image_airtime', 'spalash_image_deadline', 'status', 'created_at', 'updated_at')
|
@@ -157,7 +157,7 @@ |
||
| 157 | 157 |
<div class="description text-muted">即拍即分享</div> |
| 158 | 158 |
<div class="download"> |
| 159 | 159 |
<a href=""> |
| 160 |
- <button class="hero-button">下载<strong>v1.0.0</strong></button> |
|
| 160 |
+ <button class="hero-button">下载<strong>v{{ version }}</strong></button>
|
|
| 161 | 161 |
</a> |
| 162 | 162 |
</div> |
| 163 | 163 |
</article> |
@@ -267,6 +267,10 @@ PAI2_HOME_PER_PAGE = 20 # 首页照片每页数量 |
||
| 267 | 267 |
PAI2_HOME_MAX_PAGE = 20 # 首页照片最大页数 |
| 268 | 268 |
PAI2_HOME_MAX_ROWS = 400 # 首页照片最大数量, PAI2_HOME_PER_PAGE * PAI2_HOME_MAX_PAGE = 20 * 20 = 400 |
| 269 | 269 |
|
| 270 |
+# 下载页设置 |
|
| 271 |
+DOWNLOAD_TMPL_PATH = os.path.join(BASE_DIR, 'page/templates/page/download.tmpl.html').replace('\\', '/')
|
|
| 272 |
+DOWNLOAD_PAGE_PATH = os.path.join(BASE_DIR, 'page/templates/page/download.html').replace('\\', '/')
|
|
| 273 |
+ |
|
| 270 | 274 |
# 群组设置 |
| 271 | 275 |
GROUP_PER_PAGE = 20 # 群组每页数量 |
| 272 | 276 |
|
@@ -0,0 +1,8 @@ |
||
| 1 |
+# -*- coding: utf-8 -*- |
|
| 2 |
+ |
|
| 3 |
+from CodeConvert import CodeConvert as cc |
|
| 4 |
+ |
|
| 5 |
+ |
|
| 6 |
+def write_to_disk(tmpl, path): |
|
| 7 |
+ with open(path, 'wb') as f: |
|
| 8 |
+ f.write(cc.Convert2Utf8(tmpl)) |